﻿using AutoMapper;
using BlogApi.Models;
using BlogApi.ModelsDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlogApi.Profiles
{
    public class UserProfile:Profile
    {
        public UserProfile()
        {
            CreateMap<User, UserInfoDto>().ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.UserNickName, opt => opt.MapFrom(src => src.NickName))
                .ForMember(dest => dest.UserImg, opt => opt.MapFrom(src => src.UserImageUrl))
                .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Introduction));
            CreateMap<UserAddDto, User>().ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.UserEmail));
        }
    }
}
